export const initViewport = () => {
  const setScale = () => {
    const vw = window.innerWidth
    const vh = window.innerHeight
    const designWidth = 1920
    const designHeight = 1080
    
    // 横向缩放限制
    const scaleX = vw / designWidth
    const scaleY = vh / designHeight
    
    // 应用动态缩放（仅在大屏需要时）
    if (vw > designWidth) {
      document.documentElement.style.transform = `scale(${Math.min(scaleX, scaleY)})`
      document.documentElement.style.transformOrigin = 'top left'
    } else {
      document.documentElement.style.transform = 'none'
    }
  }

  window.addEventListener('resize', setScale)
  setScale()
}